// 单例模式 代理单例 职责单一
const getSingle = (fn) => {
  let result
  return (...args) => result || (result = new fn(...args))
}

function Test(name){
  console.log(name)
  this.name = name
}

const createSingleTest = getSingle(Test)
const test = createSingleTest('lodash')
const test2 = createSingleTest('lodash223')
console.log(test, test2)